<?php
session_start();
ob_start();
/*************************
 * (c) Curyłło Piotr
 * 
 * P-CMS, 2012.
 * 
 * 
 */

ini_set('display_errors', 1); 
ini_set('log_errors', 1); 
error_reporting(E_ALL);

define('APP', 1);

include "config/path.php";
require_once "i18n/pl.php";
include "library/system/system.php";
include "library/log/log.php";
include "library/db/db.php";

require_once "library/system/controller.php";
include "library/system/privileges.php";
include "library/view/flash_message.php";
include "library/view/view.php";
include "library/mail/mail.php";
require_once 'library/system/recaptchalib.php';

View::setRoot("http://127.0.0.3");


include "model/UserModel.php";
require_once 'model/DemotModel.php';

DB::connect();
$config = Controller::getConfig();


$controller = isset ($_REQUEST['controller']) ? $_REQUEST['controller'] : $config['global']['defaultController'];
$action = isset ($_REQUEST['action']) ? $_REQUEST['action'] : "";

View::setLang($LANG);

//setup default template for all children controller's

Controller::setTemplate($config['defaultTemplates']['frontend']);

require_once 'controller/AdminController.php'; 
require_once 'controller/UserController.php'; 
require_once 'controller/IndexController.php'; 
require_once 'controller/DemotController.php'; 

require_once 'library/system/dstatus.php';


System::run($controller.'Controller', $action);

?>